#include <cstdio>
#include <algorithm>
using namespace std;

struct Line
{
	int u, v, w;
	bool operator < (const Line &x) const { return w < x.w; }
	void init() { scanf("%d%d%d", &u, &v, &w); }
} *line;
int n, m, s, t, *fa, ans_max = 1, ans_min;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
int main()
{
	int i, j, u, v, max_w, min_w, r, start = 0;
	scanf("%d%d", &n, &m);
	line = new Line[m];
	fa = new int[n+1];
	for(i = 0; i < m; ++i) line[i].init();
	sort(line, line + m);
	scanf("%d%d", &s, &t);
	while(start < m)
	{
		min_w = max_w = -1;
		for(int k = 1; k <= n; ++k) fa[k] = k;
		for(j = start; j < m; ++j)
		{
			u = find(line[j].u); v = find(line[j].v); fa[u] = v;
			if(find(s) == find(t)) { max_w = line[j].w; break; }
		}
		if(max_w == -1)
		{
			if(!ans_min) { printf("IMPOSSIBLE\n"); return 0; }
			else break;
		}
		for(int k = 1; k <= n; ++k) fa[k] = k;
		for( ; j >= 0; --j)
		{
			u = find(line[j].u); v = find(line[j].v); fa[u] = v;
			if(find(s) == find(t)) { min_w = line[j].w; break; }
		}
		start = j + 1;
		if(min_w == -1)
		{
			if(!ans_min) { printf("IMPOSSIBLE\n"); return 0; }
			else break;
		}
		r = gcd(max_w, min_w); max_w /= r; min_w /= r;
		if(ans_max * min_w > ans_min * max_w) { ans_max = max_w; ans_min = min_w; }
	}
	if(ans_min == 1) printf("%d\n", ans_max);
	else printf("%d/%d\n", ans_max, ans_min);
	delete[] line;
	delete[] fa;
	return 0;
}


/*class Line{
public:
	int u, v, w;
public:
	Line(){}
	~Line(){}
	void Init()
	{
		scanf("%d %d %d", &u, &v, &w);
	}
	bool operator <(const Line &l)
	{
		return (w < l.w);
	}
};

class UnionSearchSet{
public:
	Line *line;
	int *fa;
	int m, n;
public:
	UnionSearchSet()
	{
		scanf("%d %d", &n, &m);
		line = new Line[m];
		fa = new int[n+1];
	}
	~UnionSearchSet()
	{
		delete[] line;
		delete[] fa;
	}
	int Find(int x)
	{
		return (x == fa[x]?x : fa[x] = Find(fa[x]));
	}
	void SetFa()
	{
		for(int i = 1; i <= n; i++)
			fa[i] = i;
	}
	void InitLine()
	{
		int i;
		for(i = 0; i < m; i++)
		{
			line[i].Init();
		}
		sort(line, line+m);
	}
	int Gcd(int max, int min)
	{
		return min != 0 ? Gcd(min, max % min) : max;
	}
	void Search(int s, int e)
	{
		int max_w, min_w, max = 1, min = 0, common, i, start = 0, u, v;
		while(start < m)
		{
			max_w = min_w = -1;
			SetFa();
			for(i = start; i < m; i++)
			{
				u = fa[line[i].u];
				v = fa[line[i].v];
				fa[u] = v;
				if(Find(s) == Find(e))
				{
					max_w = line[i].w;
					break;
				}
			}
			if(max_w == -1)
			{
				if(min == 0)
				{
					printf("IMPOSSIBLE\n");
					//system("Pause");
					return ;
				}
				else
					break;
			}
			SetFa();
			for(; i >= 0; i--)
			{
				u = fa[line[i].u];
				v = fa[line[i].v];
				fa[u] = v;
				if(Find(s) == Find(e))
				{
					min_w = line[i].w;
					break;
				}
			}
			if(min_w == -1)
			{
				if(min == 0)
				{
					printf("IMPOSSIBLE\n");
					//system("Pause");
					return ;
				}
				else
					break;
			}
			start = i+1;
			common = Gcd(max_w, min_w);
			max_w /= common;
			min_w /= common;
			if(min * max_w < max * min_w)
			{
				max = max_w;
				min = min_w;
			}
		}
		if(min == 1)
		{
			printf("%d\n", max);
		}
		else
		{
			printf("%d/%d\n",max, min);
		}
	}
};

int main()
{
	int s, e;
	UnionSearchSet set;
	set.InitLine();
	scanf("%d %d", &s, &e);
	set.Search(s, e);
	system("Pause");
	return 0;
}
*/